package com.example.medmobile.profissional;

import java.io.IOException;

import utils.BaseActivity;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.view.Menu;
import android.view.View;
import android.widget.Button;

import com.cedarsoftware.util.io.JsonReader;
import com.example.medmobile.Global;
import com.example.medmobile.R;
import com.google.appengine.medmobileserver.business.Profissional;

public class PrincipalProfissional extends BaseActivity {

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_principal_profissional);
		Bundle extras = getIntent().getExtras();
		if (extras != null) {
			String profissional = extras.getString("profissional");
			Profissional prof;
			try {
				prof = (Profissional) JsonReader.jsonToJava(profissional);
				Global.setProfissionalLogado(prof);
			} catch (IOException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}

		}
		Button btnBuscar = (Button) findViewById(R.id.btCaixaEntradaProfissional);
		btnBuscar.setOnClickListener(new View.OnClickListener() {

			@Override
			public void onClick(View v) {
				Intent intent = new Intent();
				intent.setClass(PrincipalProfissional.this,
						CaixaEntradaProfissionalHandler.class);
				startActivity(intent);

			}
		});

		((Button) findViewById(R.id.btAgendaProfissional))
				.setOnClickListener(new View.OnClickListener() {

					@Override
					public void onClick(View v) {

						Intent intent = new Intent();
						intent.setClass(PrincipalProfissional.this,
								ListaAgendamentoProfissionalHandler.class);
						startActivity(intent);

					}
				});

	}

	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		// Inflate the menu; this adds items to the action bar if it is present.
		getMenuInflater().inflate(R.menu.principal_profissional, menu);
		return true;
	}

}
